home *** CD-ROM | disk | FTP | other *** search
- ;Sprite Example (AGA only)
- ;-------------------------
- ;This example contains four 64 pixel wide sprites, in high resolution.
- ;You can move sprite number 2 around with the mouse, notice how it
- ;appears behind number 1 and in front of 3 and 4.
- ;
- ;This demo also uses the LIST feature to initialise the four sprites.
- ;
- ;The LMB exits the demo.
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "Sprites",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- lea ScreenTags(pc),a0 ;Initialise our screen for use.
- CALL ShowScreen ;Show our screen.
- tst.l d0
- beq.s .Error_Screen
-
- move.l Screen(pc),a0
- lea SpriteList(pc),a1
- CALL InitSprite
- tst.l d0
- beq.s .Error_Sprite
-
- move.l Circle1(pc),a1
- CALL UpdateSprite
- move.l Circle3(pc),a1
- CALL UpdateSprite
- move.l Circle4(pc),a1
- CALL UpdateSprite
-
- CALL InitJoyPorts
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- lea SpriteList(pc),a1
- CALL FreeSprite
- .Error_Sprite
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: move.l Circle2(pc),a1
- .loop moveq #JPORT1,d0 ;Read from port 1
- CALL ReadMouse ;Go get mouse position.
- move.w d0,d1
- asr.w #8,d0
- add.w d0,SPR_XPos(a1)
- ext.w d1
- add.w d1,SPR_YPos(a1)
-
- CALL WaitVBL ;Allow screen-switching.
- CALL UpdateSprite ;Put Sparkie on the screen.
-
- btst #MB_LMB,d0
- beq.s .loop
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- SpriteList:
- dc.l LIST
- dc.l TAGS_Circle1
- dc.l TAGS_Circle2
- dc.l TAGS_Circle3
- dc.l TAGS_Circle4
- dc.l LISTEND
-
- TAGS_Circle1:
- dc.l TAGS_SPRITE
- Circle1 dc.l 0
- dc.l SPA_Data,Gfx_Circle1
- dc.l SPA_XCoord,20
- dc.l SPA_YCoord,20
- dc.l SPA_Width,64
- dc.l SPA_Height,64
- dc.l SPA_AmtColours,16
- dc.l SPA_ColStart,16
- dc.l SPA_Planes,2
- dc.l SPA_ScrMode,HIRES
- dc.l TAGEND
-
- TAGS_Circle2:
- dc.l TAGS_SPRITE
- Circle2 dc.l 0
- dc.l SPA_Number,2
- dc.l SPA_Data,Gfx_Circle2
- dc.l SPA_XCoord,70
- dc.l SPA_YCoord,70
- dc.l SPA_Width,64
- dc.l SPA_Height,64
- dc.l SPA_AmtColours,16
- dc.l SPA_ColStart,16
- dc.l SPA_Planes,2
- dc.l SPA_ScrMode,HIRES
- dc.l TAGEND
-
- TAGS_Circle3:
- dc.l TAGS_SPRITE
- Circle3 dc.l 0
- dc.l SPA_Number,4
- dc.l SPA_Data,Gfx_Circle3
- dc.l SPA_XCoord,120
- dc.l SPA_YCoord,120
- dc.l SPA_Width,64
- dc.l SPA_Height,64
- dc.l SPA_AmtColours,16
- dc.l SPA_ColStart,16
- dc.l SPA_Planes,2
- dc.l SPA_ScrMode,HIRES
- dc.l TAGEND
-
- TAGS_Circle4:
- dc.l TAGS_SPRITE
- Circle4 dc.l 0
- dc.l SPA_Number,6
- dc.l SPA_Data,Gfx_Circle4
- dc.l SPA_XCoord,170
- dc.l SPA_YCoord,170
- dc.l SPA_Width,64
- dc.l SPA_Height,64
- dc.l SPA_AmtColours,16
- dc.l SPA_ColStart,16
- dc.l SPA_Planes,2
- dc.l SPA_ScrMode,HIRES
- dc.l TAGEND
-
- ScreenTags:
- dc.l TAGS_GAMESCREEN
- Screen: dc.l 0
- dc.l GSA_Palette,.palette
- dc.l GSA_AmtColours,32
- dc.l GSA_ScrWidth,320
- dc.l GSA_ScrHeight,256
- dc.l GSA_Planes,1
- dc.l GSA_Attrib,SPRITES|NOSCRBDR
- dc.l TAGEND
-
- .palette
- dc.l $000000,$0F0000,$1F0000,$2F0000,$3F0000,$4F0000
- dc.l $5F0000,$6F0000,$7F0000,$8F0000,$9F0000,$AF0000
- dc.l $BF0000,$CF0000,$DF0000,$EF0000,$FF0000,$001111
- dc.l $002222,$003333,$004444,$005555,$006666,$007777
- dc.l $008888,$009999,$00AAAA,$00BBBB,$00CCCC,$00DDDD
- dc.l $00EEEE,$00FFFF
-
- ;===========================================================================;
- ; ALL CHIP RAM DATA HERE
- ;===========================================================================;
-
- SECTION "Graphics",DATA_C
-
- CNOP 0,4 ;Sprite must be 64bit aligned.
- Gfx_Circle1:
- INCBIN "GMS:demos/data/RAW.CircleSpr1"
-
- CNOP 0,4 ;Sprite must be 64bit aligned.
- Gfx_Circle2:
- INCBIN "GMS:demos/data/RAW.CircleSpr2"
-
- CNOP 0,4 ;Sprite must be 64bit aligned.
- Gfx_Circle3:
- INCBIN "GMS:demos/data/RAW.CircleSpr3"
-
- CNOP 0,4 ;Sprite must be 64bit aligned.
- Gfx_Circle4:
- INCBIN "GMS:demos/data/RAW.CircleSpr3"
-
-
-